<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>Ubuntu14.04搭建VPN服务 | 素墨文胤</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="Ubuntu14.04搭建VPN服务

第一步需要安装PPTP，以用来提供VPN服务 1.1 #apt-get install pptpd 1.2 如果有问题的话比如提示找不到之类的，apt-get update 一下应该就可以了，然后再来一次就会自动完成安装。

装好了之后我们需要进行配置一下以让它可以使用 2.1 #nano /etc/pptpd.conf 2.1 取消掉以下 2 行的注释：">
<meta property="og:type" content="article">
<meta property="og:title" content="Ubuntu14.04搭建VPN服务">
<meta property="og:url" content="http://godera.org/2016/03/25/Ubuntu14-04搭建VPN服务/index.html">
<meta property="og:site_name" content="素墨文胤">
<meta property="og:description" content="Ubuntu14.04搭建VPN服务

第一步需要安装PPTP，以用来提供VPN服务 1.1 #apt-get install pptpd 1.2 如果有问题的话比如提示找不到之类的，apt-get update 一下应该就可以了，然后再来一次就会自动完成安装。

装好了之后我们需要进行配置一下以让它可以使用 2.1 #nano /etc/pptpd.conf 2.1 取消掉以下 2 行的注释：">
<meta property="og:updated_time" content="2016-03-30T07:54:44.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Ubuntu14.04搭建VPN服务">
<meta name="twitter:description" content="Ubuntu14.04搭建VPN服务

第一步需要安装PPTP，以用来提供VPN服务 1.1 #apt-get install pptpd 1.2 如果有问题的话比如提示找不到之类的，apt-get update 一下应该就可以了，然后再来一次就会自动完成安装。

装好了之后我们需要进行配置一下以让它可以使用 2.1 #nano /etc/pptpd.conf 2.1 取消掉以下 2 行的注释：">
  
  
    <link rel="icon" href="/favicon.png">
  

  <link rel="stylesheet" href="/css/style.css">
  
    <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  
  
    <link rel="stylesheet" href="/scrollLoading/style.css">
  
  


  

  
    <link href='//fonts.useso.com/css?family=Titillium+Web:300,400,600' rel='stylesheet' type='text/css'>
    <link href="//fonts.useso.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/font-awesome/css/font-awesome.min.css">
</head>

<body>
  <div id="wrap">
    <header id="header">
  <div id="header-outer" class="outer">
    <div class="container">
      <div class="container-inner">
        <div id="header-title">
          <h1 class="logo-wrap">
            <a href="/" class="logo"></a>
          </h1>
          
            <h2 class="subtitle-wrap">
              <p class="subtitle">一日心静一日仙，不以神力乱人间。</p>
            </h2>
          
        </div>
        <div id="header-inner" class="nav-container">
          <a id="main-nav-toggle" class="nav-icon fa fa-bars"></a>
          <div class="nav-container-inner">
            <ul id="main-nav">
              
                <li class="main-nav-list-item" ><a class="main-nav-list-link" href="/">Home</a></li>
              
                    <ul class="main-nav-list"><li class="main-nav-list-item"><a class="main-nav-list-link" href="/categories/JS/">JS</a></li><li class="main-nav-list-item"><a class="main-nav-list-link" href="/categories/Unix-Linux/">Unix_Linux</a></li><li class="main-nav-list-item"><a class="main-nav-list-link" href="/categories/iOS/">iOS</a></li><li class="main-nav-list-item"><a class="main-nav-list-link" href="/categories/哲学辨思/">哲学辨思</a></li><li class="main-nav-list-item"><a class="main-nav-list-link" href="/categories/数据库/">数据库</a></li><li class="main-nav-list-item"><a class="main-nav-list-link" href="/categories/文字文化/">文字文化</a></li><li class="main-nav-list-item"><a class="main-nav-list-link" href="/categories/生活感悟/">生活感悟</a></li><li class="main-nav-list-item"><a class="main-nav-list-link" href="/categories/随心随性/">随心随性</a></li><li class="main-nav-list-item"><a class="main-nav-list-link" href="/categories/默认标签/">默认标签</a></li></ul>
                  
                <li class="main-nav-list-item" ><a class="main-nav-list-link" href="/about/index.html">About</a></li>
              
            </ul>
            <nav id="sub-nav">
              <div id="search-form-wrap">
                
                  <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><input type="hidden" name="sitesearch" value="http://godera.org"></form>
                
              </div>
            </nav>
          </div>
        </div>
      </div>
    </div>
  </div>
</header>
    <div class="container">
      <div class="main-body container-inner">
        <div class="main-body-inner">
          <section id="main">
            <div class="main-body-header">

              <h1 class="header"><a class="page-title-link" href="/categories/Unix-Linux/">Unix_Linux</a></h1>
            </div>
            <div class="main-body-content">
              
  <article id="post-Ubuntu14-04搭建VPN服务" class="article article-single article-type-post" itemscope itemprop="blogPost">
    <div class="article-inner">
      <!--  -->
      
        <header class="article-header">
          
  
    <h1 class="article-title" itemprop="name">
      Ubuntu14.04搭建VPN服务
    </h1>
  

        </header>
      
      <p class="article-byline">
        <a href="/2016/03/25/Ubuntu14-04搭建VPN服务/" class="article-date">
  <time datetime="2016-03-25T07:46:08.000Z" itemprop="datePublished">2016-03-25</time>
</a>
      </p>
      <div class="article-entry" itemprop="articleBody">
        <p>Ubuntu14.04搭建VPN服务</p>
<ol>
<li><p>第一步需要安装PPTP，以用来提供VPN服务<br> 1.1 #apt-get install pptpd<br> 1.2 如果有问题的话比如提示找不到之类的，apt-get update 一下应该就可以了，然后再来一次就会自动完成安装。</p>
</li>
<li><p>装好了之后我们需要进行配置一下以让它可以使用<br> 2.1 #nano /etc/pptpd.conf<br> 2.1 取消掉以下 2 行的注释：</p>
<pre><code><span class="number">2.1</span><span class="string">.1</span>. localip <span class="number">192.168</span><span class="string">.0</span><span class="string">.1</span> （<span class="number">192.168</span><span class="string">.0</span><span class="string">.1</span> 改成VPS的外网独立<span class="literal">IP</span>）
<span class="number">2.1</span><span class="string">.2</span>. remoteip <span class="number">192.168</span><span class="string">.0</span><span class="string">.234</span>-<span class="number">238</span>,<span class="number">192.168</span><span class="string">.0</span><span class="string">.245</span> （“<span class="number">192.168</span><span class="string">.0</span><span class="string">.234</span>-<span class="number">238</span>,<span class="number">192.168</span><span class="string">.0</span><span class="string">.245</span>”改成分配给用户的<span class="literal">IP</span>段，例如：<span class="number">10.10</span><span class="string">.10</span><span class="string">.100</span>-<span class="number">200</span>） 
</code></pre></li>
<li><p>然后我们需要分配账号给自己使用<br> 3.1 #nano /etc/ppp/chap-secrets<br> 3.2 添加账户，例如：test pptpd “123” *</p>
<pre><code>格式：用户名（<span class="constant">tab</span>键）协议（<span class="constant">tab</span>键）“密码”（<span class="constant">tab</span>键）*
PS：密码用引号引起，最后的*号表示允许在任意IP连接到服务
</code></pre></li>
<li><p>配置 DNS<br> 4.1 #nano /etc/ppp/pptpd-options<br> 4.2 找到 ms-dns，取消掉注释<br> 4.3 修改为当地DNS或谷歌DNS，例如：8.8.8.8，8.8.4.4</p>
</li>
<li><p>开启内核IP转发<br> 5.1 #nano /etc/sysctl.conf<br> 5.2 取消掉 net.ipv4.ip_forward=1 这一行的注释.<br> 5.3 #sysctl -p 使之生效</p>
</li>
<li><p>安装iptables，开启NAT转发<br> 6.1 #apt-get install iptables（如果没有安装iptables）<br> 6.2 #iptables -t nat -I POSTROUTING -j MASQUERADE （开启nat转发）</p>
</li>
<li><p>重启服务，让配置生效<br> 7.1 #service pptpd restart</p>
</li>
</ol>
<p>【总结】虽然可以自己搭建服务器，但是需要注意 ip 被封后的处理。综合下来还是不如直接买大品牌 VPN 合算和好用。</p>

      </div>
      <footer class="article-footer">
        <a data-url="http://godera.org/2016/03/25/Ubuntu14-04搭建VPN服务/" data-id="ciw7o5qhz001b3refnq5s8bnp" class="article-share-link"><i class="fa fa-share"></i>Share</a>
        
        
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Unix-Linux/">Unix_Linux</a></li></ul>

      </footer>
    </div>
  </article>
  
  


<!--高速版-->
<div id="SOHUCS"></div>
<script charset="utf-8" type="text/javascript" src="http://changyan.sohu.com/upload/changyan.js" ></script>
<script type="text/javascript">
    window.changyan.api.config({
        appid: 'cys5Qvajj',
        conf: 'prod_62197afb84b42bd16c642feedaaef9f1'
    });
</script>   

            </div>
          </section>
          <aside id="sidebar">
  <a class="sidebar-toggle" title="Expand Sidebar"><i class="toggle icon"></i></a>
  <div class="sidebar-top">
    <p>follow:</p>
    <ul class="social-links">
      
        <li><a class="social-tooltip" title="github" href="https://github.com/godera" target="_blank"><i class="icon fa fa-github"></i></a></li>
      
    </ul>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2016/03/28/iOS-CUICatalog-Invalid-asset-name-supplied-null/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">newer</strong>
      <p class="article-nav-title">
        
          iOS CUICatalog: Invalid asset name supplied: (null)
        
      </p>
      <i class="icon fa fa-chevron-right" id="icon-chevron-right"></i>
    </a>
  
  
    <a href="/2016/02/17/Missing-iOS-Distribution-signing-identity-for-…/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">older</strong>
      <p class="article-nav-title">Missing iOS Distribution signing identity for … </p>
      <i class="icon fa fa-chevron-left" id="icon-chevron-left"></i>
    </a>
  
</nav>

  
  <div class="widgets-container">
    
      
  <div class="widget-wrap">
    <h3 class="widget-title">recents</h3>
    <div class="widget">
      <ul id="recent-post" class="">
        
          <li>
            
            <div class="item-thumbnail">
              
<a href="/2016/11/30/Markdown-技巧汇总（持续帖）/" class="thumbnail">
  
    <span class="thumbnail-image thumbnail-none"></span>
  
</a>

            </div>
            
            <div class="item-inner">
              <p class="item-category"><a class="article-category-link" href="/categories/iOS/">iOS</a></p>
              <p class="item-title"><a href="/2016/11/30/Markdown-技巧汇总（持续帖）/" class="title">Markdown 技巧汇总（持续帖）</a></p>
              <p class="item-date"><time datetime="2016-11-30T05:10:18.000Z" itemprop="datePublished">2016-11-30</time></p>
            </div>
          </li>
        
          <li>
            
            <div class="item-thumbnail">
              
<a href="/2016/11/27/CocoaPods-指南/" class="thumbnail">
  
    <span class="thumbnail-image thumbnail-none"></span>
  
</a>

            </div>
            
            <div class="item-inner">
              <p class="item-category"><a class="article-category-link" href="/categories/iOS/">iOS</a></p>
              <p class="item-title"><a href="/2016/11/27/CocoaPods-指南/" class="title">CocoaPods 指南</a></p>
              <p class="item-date"><time datetime="2016-11-27T11:03:26.000Z" itemprop="datePublished">2016-11-27</time></p>
            </div>
          </li>
        
          <li>
            
            <div class="item-thumbnail">
              
<a href="/2016/04/16/OC-和-Swift-的混用方法/" class="thumbnail">
  
    <span class="thumbnail-image thumbnail-none"></span>
  
</a>

            </div>
            
            <div class="item-inner">
              <p class="item-category"><a class="article-category-link" href="/categories/iOS/">iOS</a></p>
              <p class="item-title"><a href="/2016/04/16/OC-和-Swift-的混用方法/" class="title">OC 和 Swift 的混用方法</a></p>
              <p class="item-date"><time datetime="2016-04-16T11:11:42.000Z" itemprop="datePublished">2016-04-16</time></p>
            </div>
          </li>
        
          <li>
            
            <div class="item-thumbnail">
              
<a href="/2016/04/11/ReactiveCocoa-简单总结/" class="thumbnail">
  
    <span class="thumbnail-image thumbnail-none"></span>
  
</a>

            </div>
            
            <div class="item-inner">
              <p class="item-category"><a class="article-category-link" href="/categories/iOS/">iOS</a></p>
              <p class="item-title"><a href="/2016/04/11/ReactiveCocoa-简单总结/" class="title">ReactiveCocoa 简单总结</a></p>
              <p class="item-date"><time datetime="2016-04-11T03:00:29.000Z" itemprop="datePublished">2016-04-11</time></p>
            </div>
          </li>
        
          <li>
            
            <div class="item-thumbnail">
              
<a href="/2016/04/09/从汉语字面理解-观察者模式-和-订阅者模式-的区别/" class="thumbnail">
  
    <span class="thumbnail-image thumbnail-none"></span>
  
</a>

            </div>
            
            <div class="item-inner">
              <p class="item-category"><a class="article-category-link" href="/categories/Unix-Linux/">Unix_Linux</a></p>
              <p class="item-title"><a href="/2016/04/09/从汉语字面理解-观察者模式-和-订阅者模式-的区别/" class="title">从汉语字面理解 观察者模式 和 订阅者模式 的区别</a></p>
              <p class="item-date"><time datetime="2016-04-09T10:19:20.000Z" itemprop="datePublished">2016-04-09</time></p>
            </div>
          </li>
        
      </ul>
    </div>
  </div>

    
      
  <div class="widget-wrap widget-list">
    <h3 class="widget-title">archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/11/">November 2016</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/">April 2016</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">March 2016</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/02/">February 2016</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/01/">January 2016</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/12/">December 2015</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/11/">November 2015</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/10/">October 2015</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/09/">September 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/08/">August 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/06/">June 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/05/">May 2015</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/04/">April 2015</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/03/">March 2015</a><span class="archive-list-count">36</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/02/">February 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/01/">January 2015</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/10/">October 2014</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/06/">June 2012</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2011/10/">October 2011</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2010/06/">June 2010</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2008/08/">August 2008</a><span class="archive-list-count">1</span></li></ul>
    </div>
  </div>


    
      
  <div class="widget-wrap widget-float">
    <h3 class="widget-title">tag cloud</h3>
    <div class="widget tagcloud">
      <a href="/tags/JS/" style="font-size: 10px;">JS</a> <a href="/tags/Unix-Linux/" style="font-size: 14px;">Unix_Linux</a> <a href="/tags/iOS/" style="font-size: 20px;">iOS</a> <a href="/tags/哲学辨思/" style="font-size: 16px;">哲学辨思</a> <a href="/tags/数据库/" style="font-size: 10px;">数据库</a> <a href="/tags/文字文化/" style="font-size: 18px;">文字文化</a> <a href="/tags/生活感悟/" style="font-size: 14px;">生活感悟</a> <a href="/tags/随心随性/" style="font-size: 12px;">随心随性</a> <a href="/tags/默认标签/" style="font-size: 10px;">默认标签</a>
    </div>
  </div>


    
      
  <div class="widget-wrap widget-list">
    <h3 class="widget-title">links</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="http://hexo.io">Hexo</a>
          </li>
        
      </ul>
    </div>
  </div>


    
  </div>
</aside>
        </div>
      </div>
    </div>
    <footer id="footer">
  
  <div class="container">
    <div class="container-inner">
      <a id="back-to-top" href="javascript:;"><i class="icon fa fa-angle-up"></i></a>
      <div class="credit">
        <h1 class="logo-wrap">
          <a href="/" class="logo"></a>
        </h1>
        <p>&copy; 2016 梁逊</p>
        <p>Powered by <a href="//hexo.io/" target="_blank">Hexo</a>. Theme by <a href="//github.com/ppoffice" target="_blank">PPOffice</a></p>
      </div>
    </div>
  </div>
</footer>
    


  <script src="http://code.jquery.com/jquery-2.1.3.min.js"></script>



  <script src="/fancybox/jquery.fancybox.pack.js"></script>



  <script src="/scrollLoading/jquery.scrollLoading.js"></script>
  <script src="/scrollLoading/main.js"></script>




<script src="/js/html-patch.js"></script>
<script src="/js/script.js"></script>

  </div>
</body>
</html>
